package ThisPractise02;

public class Account {
    private double balance;//余额

    public Account(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }
    /*存钱方法*/
    public void deposit(double amount){
        if(amount>0){
            balance+=amount;
            System.out.println("成功存入"+amount+"\t"+"账户剩余"+balance);
        }
    }
    /*取钱方法*/
    public void withdraw(double amount){
        if(balance>=amount && amount>0){
            balance-=amount;
            System.out.println("成功取出"+amount+"\t"+"账户剩余"+balance);
        }
    }
}
